﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="editwz.aspx.cs" Inherits="weba.editwz" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
     <style type="text/css">
	html { height:100% }
	body { height:100%; margin:0px; padding:0px }
	   #container {
           height: 450px;
           width: 800px;
           float: left;
       }
       #form1 {
           width: 800px;
           height: 300px;
           float: left;
       }
       #ztd {
           height: auto;
           width: 150px;
           float: left;
       }
   </style>
    <script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.2&key=ab5ae8097e26040fa604012b73e78f03">
</script>   
<script type="text/javascript">
    var ln;
    var point
    function raa() {

        // x=   WebService.HelloWorld();
        //  alert("adda");
        //  x = ln.getLng();
        //  var y = ln.getlnt();
        alert(x);

    }
    function a() {
        //  weba.wajax.HelloWorld(onresult);
        x = ln.getLng();
        y = ln.getLat();
        weba.wajax.genxing(x, y, '<%= Request.QueryString["id"] %>', onresult)

    }
    function onresult(result) {
        alert(result);
    }
    function initialize() {
        jd = '<%= Request.QueryString["jd"] %>'
        wd = '<%= Request.QueryString["wd"] %>'
        var mapObj = new AMap.Map("container");
        mapObj.setZoom(12);// 创建地图实例
        if (jd == "") {
            point = new AMap.LngLat(121.550331, 29.868038); // 创建点坐标
        }
        else {
            point = new AMap.LngLat(jd, wd);
            var markera = new AMap.Marker({
                id: "m122",
                position: new AMap.LngLat(jd, wd),
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });// 创建点坐标
            mapObj.addOverlays(markera);
        }

        //  alert(ln.getLng());

        // var point = new AMap.LngLat(116.404, 39.915); // 创建点坐标
        mapObj.setCenter(point); // 设置地图中心点坐标

        mapObj.bind(mapObj, "click", function (e) {
            ln = e.lnglat;
            var marker = new AMap.Marker({
                id: "m123",
                position: e.lnglat,
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });
            //  alert(ln.getLng());
            mapObj.addOverlays(marker);
            mapObj.setCenter(ln);

        });
    }

</script>
   
     
</head>
<body  onLoad="initialize()">
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="Id" DataSourceID="LinqDataSource1" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="pid" HeaderText="pid" SortExpression="pid" />
                <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
                <asp:BoundField DataField="shuoming" HeaderText="shuoming" SortExpression="shuoming" />
                <asp:BoundField DataField="tupianurl" HeaderText="tupianurl" SortExpression="tupianurl" />
                <asp:BoundField DataField="tel" HeaderText="tel" SortExpression="tel" />
                <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" />
                <asp:BoundField DataField="lx" HeaderText="lx" SortExpression="lx" />
                <asp:BoundField DataField="ly" HeaderText="ly" SortExpression="ly" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
          <input id="Button1" type="button" value="改为此位置" onClick="a()" /><asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="刷新页面" /><asp:Button ID="Button3" runat="server" Text="后退" OnClick="Button3_Click" />
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="weba.sjklqDataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName="" TableName="dituwz" Where="Id == @Id">
            <WhereParameters>
                <asp:QueryStringParameter Name="Id" QueryStringField="id" Type="Int32" />
            </WhereParameters>
        </asp:LinqDataSource>
   <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True">
            <Services>
                <asp:ServiceReference Path="wajax.asmx"  />
            </Services>
        </asp:ScriptManager>
        </div>
         
   <div id="container"></div> 
    </form>
</body>
</html>
